package com.itzhoun.strategy.context;

/**
 * @author 周楠
 * @Date 2022/11/30/下午 9:36
 */
public class CashReturn extends CashStrategy{

    //这里定义一套取钱退钱方法
    private double moneyCondition;

    //退还的钱
    private double moneyReturn;
    


    @Override
    public double acceptMoney(double money) {
        if (money > moneyCondition){
            return Math.floor(money/moneyCondition) * moneyReturn;
        }
        return money;
    }

    public CashReturn(double moneyCondition, double moneyReturn) {
        this.moneyCondition = moneyCondition;
        this.moneyReturn = moneyReturn;
    }
}
